//
//  HBHotCoinChartBaseView.m
//  FindClass
//
//  Created by tianlong on 2024/12/4.
//

#import "HBHotCoinChartBaseView.h"

@implementation HBHotCoinChartBaseView

- (instancetype)initWithChartModel:(HBHotCointChartModel *)chartModel {
    self = [super init];
    if (self) {
        //视图横轴显示5个时间，数组长度不被2整除的丢弃靠前的那组数据
        if (chartModel.pointList.count % 2 == 0) {
            chartModel.pointList = [chartModel.pointList subarrayWithRange:NSMakeRange(1, chartModel.pointList.count - 1)];
        }
        if (chartModel.xList.count % 2 == 0) {
            chartModel.xList = [chartModel.xList subarrayWithRange:NSMakeRange(1, chartModel.xList.count - 1)];
        }
        chartModel.pointList = chartModel.pointList.reverseObjectEnumerator.allObjects;
        chartModel.xList = chartModel.xList.reverseObjectEnumerator.allObjects;
        self.chartModel = chartModel;
    }
    return self;
}

- (void)reload:(HBHotCointChartModel *)model {
    if (model) {
        self.chartModel = model;
    }
}

@end
